package com.bite.friend.Controller;

import com.bite.friend.DTO.QuestionListDTO;
import com.bite.friend.Service.QuestionService;
import com.bite.friend.VO.QuestionDetailVO;
import domain.R;
import domain.TableDataInfo;
import lombok.Getter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/question")
/**
 * 题目模块
 */
public class QuestionController {

    @Autowired
    private QuestionService questionService;

    /**
     * 查询题目列表
     * @param questionListDTO
     * @return
     */
    @GetMapping("/semiLogin/list")
    private TableDataInfo list(QuestionListDTO questionListDTO) {
        return questionService.list(questionListDTO);
    }

    /**
     * 根据题目id来查询题目详情
     * @param questionId
     * @return
     */
    @GetMapping("/questionDetail")
    private R<QuestionDetailVO> questionDetail(Long questionId) {
        return questionService.questionDetail(questionId);
    }

    /**
     * 切换题目到上一题
     */
    @GetMapping("/preQuestion")
    private R<String> preQuestion(Long questionId) {
        return questionService.preQuestion(questionId);
    }


    /**
     * 切换题目到下一题
     */
    @GetMapping("/nextQuestion")
    private R<String> nextQuestion(Long questionId) {
        return questionService.nextQuestion(questionId);
    }




}
